package gestion.camping.vue;

import gestion.camping.dto.Reservation;

import java.util.List;

import javax.swing.table.DefaultTableModel;

public class TableReservationModel extends DefaultTableModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public TableReservationModel(List<Reservation> listReservation, String [] columnNames) {
		super(columnNames, 0);
      
  		if(listReservation != null){
		    for(Reservation reservation : listReservation){
		    	String[] reservationData ={String.valueOf(reservation.getId()), 
		    							   String.valueOf(reservation.getEmplacement().getId()), 
		    							   reservation.getDateDebutString(),
		    							   reservation.getDateFinString(),
		    							   reservation.getClient().getNom(),
		    							   reservation.getClient().getPrenom(),
		    							   reservation.getStatut().getLibelle()};
				
		    	addRow(reservationData);
		    }
  		}
    }
	
	@Override
	public boolean isCellEditable(int row, int col) {
		return false;
	}
}

